package com.example.ISearchBlog.common;

import org.springframework.util.StringUtils;

public class StringTools {

    public static String subLength(String val, int maxLength) {
        if (!StringUtils.hasLength(val) || maxLength <= 0) return val;
        if (val.length() <= maxLength) return val;
        return val.substring(0,maxLength) + " . . . . ."; //左闭右开
    }

}
